import tastypie
from tastypie import fields
from tastypie.api import Api
from tastypie.exceptions import *
from weblib.django.tastypie._all import *



# class DatasetMoldResource(ModelResource):
#     info_template = fields.CharField(attribute="info_template")
#
#     class Meta:
#         always_return_data = True
#         queryset = DatasetMold.objects.all()
#         resource_name = 'mold'
#         fields = ['name', 'desc', 'note', 'update_dt']
#
#       #  authentication = DjangoOrBasicAuthentication()
#         # authorization = Authorization()
#         detail_uri_name = 'name'
#
#
# class DatasetResource(ModelResource):
#     info = fields.DictField(attribute='info', use_in='detail')
#     mold_name = fields.CharField(attribute='mold_name')
#     schema = fields.DictField(attribute=None, use_in='detail')
#
#     class Meta:
#         always_return_data = True
#         queryset = DataSet.objects.all().order_by('priority')
#         resource_name = 'dataset'
#         fields = ['name', 'desc', 'size', 'update_dt', 'priority']
#       #  authentication = DjangoOrBasicAuthentication()
#       #  authorization = DatasetAuthorization()
#
#         detail_uri_name = 'name'
#
#     def dehydrate_schema(self, bundle):
#         return bundle.obj.dataset.get_schema(request=bundle.request)


# REGLIST = [DatasetMoldResource, DatasetResource]
# datakeeper_api = Api(api_name='api')
# for to_reg in REGLIST:
#     datakeeper_api.register(to_reg())
